home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
pascal
/
pcxbgi1.exe
/
lha
/
TC.DOC
< prev
next >
Wrap
Text File
|
1991-03-03
|
3KB
|
62 lines
How To Use PCX2BGI Images In Turbo C Programs
By Marty Balash, Waterbury CT
Draw your images using a paint program such as Deluxe Paint or
PC-Paintbrush, which save in .LBM or .PCX format. If you use another paint
program, find a commercial or shareware conversion program that will
convert to .LBM or .PCX - there are many available. Use the 640x349
16-color mode of your paint program.
Following the instructions in PCX2BGI.DOC, use PCX2BGI.EXE to
load your picture and select a "Partial Screen" or "Full Screen" type of
image save.
With your picture displayed on the screen, frame and save the sections of
the picture you would like to use in your program. After saving them as
.MJB files, use the following six steps to load and display them from disk.
SIX STEPS to read and display a .MJB image in a Turbo C program:
1 - Read the 28-byte header to get the following information:
* struct IMAGEHDR{
* char id[8]; /* id - Should be "PCX2BGI" */
* unsigned size; /* size - bytes to malloc */
* struct palettetype palette; /* palette - for image */
* };
2 - Set the palette to "palette" using setallpalette
3 - Malloc a buffer of "size" bytes of memory
4 - Read remainder of file ("size" bytes of data) into the buffer
5 - Put the buffer on the screen with putimage
6 - Free the buffer when you're done with it
File Layouts:
o - PARTIAL SCREEN .MJB File Format:
id = "PCX2BGI"
size = <depends on image>
palette = palette for picture
a single BGI image file, "size" bytes long
o - FULL SCREEN .MJB File Format:
id = "PCX2BGI"
size = 22406
palette = palette for picture
5 consecutive BGI image files, each 22406 bytes long
For a full screen image, the filelength() function in Turbo C
will return a number larger than 22406 bytes + 28 bytes.
Note:
o - TPCONV.EXE can be used to strip the header from the data
leaving a plain BGI format image file
If you find these utilities useful, please mail $15.00 to:
Marty Balash
2 Pinecrest Dr.
Prospect CT 06712
Files in .ZIP file for Turbo C programmers:
CYCLE C - Source for program that displays & cycles picture CYCLE.MJB
READHC C - How to use hard-coded image data created by CIMAGE.EXE
SHOWMJB C - Source for .MJB display program
CIMAGE EXE - Convert a small .MJB file to C source code
CYCLE LBM - Use PCX2BGI.EXE to convert into CYCLE.MJB (save full screen)
TC DOC - Documentation for Turbo C programmers
* END OF FILE *